<?php
//调用
require_once 'wish.php';
?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="diyi.css">
</head>
<body>
    <p class="to">许愿墙</p>

    <div class="dato">
    <a class="add" href="xunyuan.php">我要许愿</a>
      <div class="niubi">
           <?php
           $sql = "SELECT * FROM `wish` ORDER BY `wish`.`id` DESC";
           $result = $conn->query($sql);
           if ($result->num_rows > 0) {
               //循环输出
               while($row = $result->fetch_assoc()){
               // var_dump($row);
                //var_dump($row["name"]);
                ?>
               
               <div class="kuang" style="background:<?php echo $row["color"] ?>;">
                   <p><?php echo $row["name"] ?></p>
                   <p><?php echo $row["content"] ?></p>
                   <p><?php echo $row["time"] ?></p>
                   <p><a href="denglu.php?id=<?php echo $row["id"];?>"><img src="img/pj.png"></a>
                   <a href="sc.php?id=<?php echo $row["id"];?>"><img src="img/sc.png"></a></p>
               </div>
             
                <?php
               }
           } else {
               echo "暂无商品";
           }
           ?>
       </div>
    </div>
    
</body>
</html>